package com.dameng.jianyouquan.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import androidx.annotation.Nullable;

public class AnimLinearLayout extends LinearLayout {


    private int width1;
    private int height1;
    private int width2;
    private int width3;
    private Paint mPaint;

    public AnimLinearLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);

    }


    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        super.onLayout(changed, l, t, r, b);

        RelativeLayout rl1 = (RelativeLayout) getChildAt(0);
        RelativeLayout rl2 = (RelativeLayout) getChildAt(1);
        RelativeLayout rl3 = (RelativeLayout) getChildAt(2);

        height1 = rl1.getHeight();
        width1 = rl1.getWidth();
        width2 = rl2.getWidth();
        width3 = rl3.getWidth();

        Log.e("TAG", width1 + "     " + width2 + "     " + width3);



    }


    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        mPaint = new Paint();
        mPaint.setAntiAlias(false);
        mPaint.setStyle(Paint.Style.FILL);
        mPaint.setAntiAlias(true);
        mPaint.setColor(Color.RED);
        int r = height1 / 4;
        canvas.drawCircle(0-r,0-r,r,mPaint);
    }
}
